<template>
  <div class="common-wrap">
    <div class="htmlPdf">
      <iframe class="iframe" :src="content" width="100%" height="100%"></iframe>
    </div>
  </div>
</template>

<script setup>
import { onActivated } from "vue";
import * as api from "@/api/index.js";
const props = defineProps({
  htmlContent: {
    type: String,
    default: "",
  },
});
const content = ref("");
onActivated(() => {
  api.default.user
    .pdfPreview({
      htmlFile: props.htmlContent,
    })
    .then((res) => {
      content.value = `data:application/pdf;base64,${res.data.base64Data}`;
    });
});
</script>

<style scoped lang="scss">
.htmlPdf {
  background: #333;
  height: 100%;
}
</style>